﻿using Autofac;
using MahApps.Metro.Controls;
using PLC.Interface.Variables;
using PLCWpfTest.Common;
using PLCWpfTest.ViewModels;
using YWM;

namespace PLCWpfTest.Views
{
    /// <summary>
    /// VariableOperationWindow.xaml 的交互逻辑
    /// </summary>
    public partial class VariableOperationWindow : MetroWindow
    {
        public VariableOperationWindow(VariableDto variable)
        {
            InitializeComponent();
            VariableOperationViewModel variableOperationViewModel = YApp.Resolve<VariableOperationViewModel>(new NamedParameter(Constant.DTO_VARIABLE, variable));
            variableOperationViewModel.RequestClose += VariableOperationViewModel_RequestClose;
            DataContext = variableOperationViewModel;
        }

        private void VariableOperationViewModel_RequestClose()
        {
            DialogResult = true;
            Close();
        }
    }
}
